package com.xyx.ssm.action;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.xyx.ssm.service.UserService;
import com.xyx.ssm.util.Page;

@Controller
@RequestMapping(value = "/user")
public class UserAction {
	@Resource
    private UserService userService;
	
	@RequestMapping("/userlist")
	public String selectAllUser1(Model model,Integer pageNow,String pageName,String departName){
	//int totalCount = userService.getProductsCount();
	//页面无页数传值
		Map<String,Object> map =new HashMap<String, Object>();
		//用户名
		map.put("pageName", pageName);
		if(pageNow==null){
			pageNow=1;
		}
		System.out.println(map.toString());
		//1:当前页码
		//1:查询参数
		Page<Map<String,Object>> page =new Page<Map<String,Object>>(pageNow,map);
		Page<Map<String,Object>> page1 =userService.findPage(page);
		page1.setParam(map);
		model.addAttribute("page", page1);
	return "user/userlist";
}
	
	
}